package qnb.controller;

/**
 * @author huangxin
 * @date 2019/5/26-20:44
 */

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import qnb.dao.StatisticsMapper;
import qnb.service.StatisticsService;

import java.util.List;
import java.util.Map;

/**
 * 统计图表
 */
@Controller
@RequestMapping(value = "statistics", produces = "application/json; charset=utf-8")
public class StatisticsController {
   @Autowired
   private StatisticsService statisticsService;
   @RequestMapping("/forward/{path}")
   public ModelAndView forward(@PathVariable("path") String path,ModelAndView modelAndView){
      modelAndView.setViewName("statistics/"+path);
      return modelAndView;
   }

   @RequestMapping("pie")
   @ResponseBody
   public List<Map<String ,Object >> statisticsStudentGrade(){
      return  statisticsService.statisticsStudentGrade();
   }

   @RequestMapping("column")
   @ResponseBody
   public List<Map<String ,Object >> statisticsStudentIn(){
      return  statisticsService.statisticsStudentIn();
   }
}
